package com.cmc.cloud.cmclink.doc.api.document;

import cn.hutool.core.bean.BeanUtil;
import com.cmc.cloud.cmclink.doc.api.document.rep.BkgTarriffNoRespDto;
import com.cmc.cloud.cmclink.doc.entity.BkgTarriffNoDO;
import com.cmc.cloud.cmclink.doc.mapper.BkgTarriffNoMapper;
import com.cmes.framework.common.pojo.CommonResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author 陈正
 * @date 2025/7/7
 */
@RestController
@Validated
public class BkgTarriffNoApiImpl implements BkgTarriffNoQueryApi {
    @Resource
    private BkgTarriffNoMapper bkgTarriffNoMapper;

    @Override
    public CommonResult<BkgTarriffNoRespDto> getByBkpCode(String bkpCode) {
        BkgTarriffNoDO bkgTarriffNo = bkgTarriffNoMapper.selectOne(BkgTarriffNoDO::getBkpCode, bkpCode);
        return CommonResult.success(BeanUtil.copyProperties(bkgTarriffNo, BkgTarriffNoRespDto.class));
    }
}
